home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HyperLib 1997 Winter - Disc 1
/
HYPERLIB-1997-Winter-CD1.ISO.7z
/
HYPERLIB-1997-Winter-CD1.ISO
/
オンラインウェア
/
PRG
/
MacPerl 506 appl folder.sit
/
MacPerl 506 appl folder
/
Mac_Perl_506r1m_appl
/
lib
/
Cwd.pm
< prev
next >
Wrap
Text File
|
1995-01-29
|
1KB
|
71 lines
package Cwd;
require 5.000;
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(getcwd fastcwd);
@EXPORT_OK = qw(chdir);
#
# The Apple Macintosh has a fast and canonic `pwd`, which simplifies the code
# a lot. -- Matthias Neeracher <neeri@iis.ee.ethz.ch>
#
# By Brandon S. Allbery
#
# Usage: $cwd = getcwd();
sub getcwd
{
my($cwd) = `pwd`;
chomp($cwd);
$cwd;
}
# By John Bazik
#
# Usage: $cwd = &fastcwd;
#
# This is a faster version of getcwd. It's also more dangerous because
# you might chdir out of a directory that you can't chdir back into.
sub fastcwd {
my($cwd) = `pwd`;
chomp($cwd);
$cwd;
}
# keeps track of current working directory in PWD environment var
#
# $RCSfile: pwd.pl,v $$Revision: 4.1 $$Date: 92/08/07 18:24:11 $
#
# $Log: pwd.pl,v $
#
# Usage:
# use Cwd 'chdir';
# chdir $newdir;
$chdir_init = 0;
sub chdir_init{
chop($ENV{'PWD'} = `pwd`);
$chdir_init = 1;
}
sub chdir {
my($newdir) = shift;
chdir_init() unless $chdir_init;
return 0 unless (CORE::chdir $newdir);
chop($ENV{'PWD'} = `pwd`);
}
1;